package cn.com.yusys.yusp.admin.validation;

import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;

import cn.com.yusys.yusp.admin.validation.ext.InDataCodeValidator;

/**
 * 校验数据是否在对应数据字典中. 
 * 如：在字段上添 @InDataCode(dataCode="") 表示数据只能是数据字典中对应码值;
 * 
 *
 * @author jiaxy2
 * @since 2.1.1
 */
@Constraint(validatedBy = { InDataCodeValidator.class })
@Documented
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
public @interface InDataCode {

    String dataCode() default "";

    String message() default "Data not in the data dictionary"; //数据不在数据字典范围内

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
